/**
 * 2016，thor.com，all rights reserved。
 * 
 * Project：		palmmall-core
 * Filename：	SMaterialQueryParamConverter.java
 * Created：		2016年9月20日
 * Creator：		wolv
 */
package com.thor.palmmall.rest.repair.converter;

import org.springframework.core.convert.converter.Converter;

import com.thor.palmmall.rest.repair.AMaterialQueryParam;
import com.thor.palmmall.spi.basic.SMaintainSource;
import com.thor.palmmall.spi.basic.SMaterialQueryParam;

/**
 * @author wolv
 *
 */
public class SMaterialQueryParamConverter implements Converter<AMaterialQueryParam, SMaterialQueryParam> {

	public static SMaterialQueryParamConverter getInstance() {
		if (instance == null)
			instance = new SMaterialQueryParamConverter();
		return instance;
	}

	private static SMaterialQueryParamConverter instance;

	private SMaterialQueryParamConverter() {
	}

	@Override
	public SMaterialQueryParam convert(AMaterialQueryParam source) {
		if (source == null)
			return null;

		SMaterialQueryParam target = new SMaterialQueryParam();
		target.setKeyWord(source.getKeyword());
		target.setMaintainObject(source.getMaintainObject());
		target.setPage(source.getPage());
		target.setPageSize(source.getPageSize());
		target.setWarehouse(source.getWarehouse());

		return target;
	}

}
